package com.cjjd.c.feature.home;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.View;
import android.widget.Button;

import com.cjjd.c.R;
import com.cjjd.c.base.ActionBarActivity;
import com.cjjd.c.feature.mine.MineFragment;
import com.cjjd.c.feature.subscribe.HotelSubscribFragment;
import com.fe.library.TabContainerView;

import butterknife.ButterKnife;

public class MainActivity extends ActionBarActivity {


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ButterKnife.bind(this);
        initView();
    }

    private TabContainerView tabContainerView;
    private int[] iconImageArray, selectedIconImageArray;
    private Fragment[] fragments;

    private int[][] mIconArray;

    private void initView() {

        mIconArray = new int[][]{{R.drawable.icon_main, R.drawable.icon_main_selected}, {R.drawable.icon_hyx, R.drawable.icon_hyx_selected},
                {R.drawable.icon_mine, R.drawable.icon_mine_selected}};

        iconImageArray = new int[]{R.drawable.icon_main, R.drawable.icon_hyx, R.drawable.icon_mine};
        selectedIconImageArray = new int[]{R.drawable.icon_main_selected, R.drawable.icon_hyx_selected, R.drawable.icon_mine_selected};
        fragments = new Fragment[]{new MainFragment(), new HotelSubscribFragment(), new MineFragment()};
//        fragments = new Fragment[]{new MainFragment(), new HyxFragment(), new MineFragment()};

        tabContainerView = (TabContainerView) findViewById(R.id.tab_containerview_main);
        tabContainerView.setAdapter(new MTabAdaptet(this,
                fragments,
                getSupportFragmentManager(),
                getResources().getStringArray(R.array.titleArray),
                iconImageArray,
                selectedIconImageArray));
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);

    }

    @Override
    public Object getTitleString() {
        return null;
    }

    @Override
    public int getContentView() {
        return R.layout.activity_main;
    }

    @Override
    public void initLeftButton(Button leftButton) {
        leftButton.setVisibility(View.GONE);
    }
}
